#!/bin/bash

. config.sh

## Here give what need ready for first install ubuntu.

## 1. mkdir directory
if [ x"$CONF_PREDIR" == x"yes" ]; then
    sudo chown v:v /opt/.
    mkdir /opt/data/data/clearsoft -p
    mkdir /opt/data/data/proj
fi

## 2. Install ubuntu software.
## use ready-ubuntu.sh

## 3. Clone projs to /opt/data/data/proj
## use ready-ubuntu.sh
. ready-ubuntu.sh

## 4. Install nginx, mongodb, golang
## use build-for-proj.sh

## 5. Install Java

## 6. Install shadowsocks
if [ x"$CONF_SS" == x"yes" ]; then
    sudo add-apt-repository ppa:hzwhuang/ss-qt5
    sudo apt-get update
    sudo apt-get install shadowsocks-qt5
fi

## 7. Install others.

## set environment

if [ x"$CONF_BASHRC" == x"yes" ]; then
    log "Set environment to bashrc.."
    TOFILE=~/.bashrc
    echo "export PATH=\"/opt/data/data/work/Qt5.5.1/5.5/gcc_64/bin:\$PATH\"" >> $TOFILE
    echo "" >> $TOFILE
    echo "export PATH=\"\$PATH:/opt/data/data/clearsoft/nginx/sbin\"" >> $TOFILE
    echo "export GOROOT=\"/opt/data/data/clearsoft/go\"" >> $TOFILE
    echo "export PATH=\"\$PATH:\$GOROOT/bin\"" >> $TOFILE
    echo "export GOPATH=\"/opt/data/data/proj/jkgo\"" >> $TOFILE
    echo "export PATH=\"\$PATH:\$GOPATH/bin\"" >> $TOFILE
    echo "" >> $TOFILE
    echo "export PATH=\"\$PATH:/opt/data/data/clearsoft/clion-2016.2.2/bin/cmake/bin/\"" >> $TOFILE
fi

if [ x"$INSTALL_THEMES" == x"yes" ]; then
    install_themes
    install_icons
fi
